import type { RouteRecordRaw } from 'vue-router';

import { DefaultLayout } from '@/fierce/layouts';
import CommonPage from '@/fierce/pages/common-page';
import demoPages from '@/support/demo-pages';

const commonRoutes: RouteRecordRaw[] = [
  {
    name: 'login',
    path: CommonPage.LOGIN,
    component: () => import('@/fierce/pages/login/index.vue'),
    meta: {
      title: '登录',
      keepAlive: false,
      affix: false,
    },
  },
  {
    name: 'forbidden',
    path: CommonPage.FORBIDDEN,
    component: () => import('@/fierce/pages/forbidden/index.vue'),
    meta: {
      title: '403',
      keepAlive: false,
      affix: false,
    },
  },
  {
    name: 'notFound',
    path: CommonPage.NOT_FOUND,
    component: () => import('@/fierce/pages/not-found/index.vue'),
    meta: {
      title: '404',
      keepAlive: false,
      affix: false,
    },
  },
  {
    path: '/:path(.*)*',
    redirect: {
      name: 'notFound',
    },
  },
  {
    path: '/redirect',
    component: DefaultLayout,
    children: [
      {
        name: 'redirect',
        path: '/redirect/:path(.*)',
        component: () => import('@/fierce/pages/redirect/index.vue'),
        meta: {
          title: '重定向',
          keepAlive: false,
          affix: false,
        },
      },
    ],
  },
  ...demoPages,
];

export default commonRoutes;
